package avicit.bdp.dms.tdm.dto;

import avicit.platform6.commons.utils.StringUtils;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import avicit.platform6.core.annotation.log.PojoRemark;
import avicit.platform6.core.domain.BaseTreeDTO;
import avicit.platform6.core.properties.PlatformConstant;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Transient;

@ApiModel(value = "BdpAssetCatalogDTO", description = "数据资产数据目录")
@PojoRemark(table = "bdp_asset_catalog", object = "BdpAssetCatalogDTO", name = "数据资产数据目录")
public class BdpAssetCatalogDTO extends BaseTreeDTO implements IExcelModel {
  private static final long serialVersionUID = 1L;

  /** 主键 */
  @Id
  @LogField
  @ApiModelProperty(value = "主键", name = "id")
  @FieldRemark(column = "ID", field = "id", name = "主键")
  @javax.persistence.Id
  @Column(name = "id")
  private String id;

  /** 父节点ID */
  @ApiModelProperty(value = "父节点ID", name = "parentId")
  @FieldRemark(column = "PARENT_ID", field = "parentId", name = "父节点ID")
  private String parentId;

  /** 父节点ID显示字段 */
  private String parentClassifyName;

  @Excel(name = "*父节点全路径", orderNum = "1", width = 30)
  @ApiModelProperty(value = "父节点全路径", name = "parentClassifyFullName")
  @Transient
  private String parentClassifyFullName;

  /** 分类名称 */
  @Excel(name = "*目录名称", orderNum = "2", width = 15)
  @ApiModelProperty(value = "目录名称", name = "classifyName")
  @FieldRemark(column = "CLASSIFY_NAME", field = "classifyName", name = "目录名称")
  private String classifyName;

  /** 分类编码 */
  @Excel(name = "*目录编码", orderNum = "3", width = 15)
  @ApiModelProperty(value = "目录编码", name = "classifyCode")
  @FieldRemark(column = "CLASSIFY_CODE", field = "classifyCode", name = "目录编码")
  private String classifyCode;

  /** 分类描述 */
  @Excel(name = "目录描述", orderNum = "4", width = 15)
  @ApiModelProperty(value = "目录描述", name = "classifyDes")
  @FieldRemark(column = "CLASSIFY_DES", field = "classifyDes", name = "目录描述")
  private String classifyDes;

  @Excel(name = "排序", orderNum = "5", width = 15)
  @ApiModelProperty(value = "排序", name = "treeSort")
  @FieldRemark(column = "TREE_SORT", field = "treeSort", name = "排序")
  private Long treeSort;

  @Transient
  @ApiModelProperty(value = "密级", name = "secretLevelName")
  @LogField
  private String secretLevelName;

  /** 编辑状态 */
  @ApiModelProperty(value = "编辑状态", name = "editStatus")
  @FieldRemark(column = "EDIT_STATUS", field = "editStatus", name = "编辑状态")
  private String editStatus;

  /** 扩展属性 */
  @ApiModelProperty(value = "扩展属性", name = "extAttr")
  @FieldRemark(column = "EXT_ATTR", field = "extAttr", name = "扩展属性")
  private String extAttr;

  /** 状态 */
  @Excel(
      name = "*状态",
      orderNum = "6",
      width = 15,
      replace = {"停用_0", "启用_1"})
  @ApiModelProperty(value = "状态", name = "status")
  @FieldRemark(column = "STATUS", field = "status", name = "状态")
  private String status;

  /** 描述 */
  @ApiModelProperty(value = "描述", name = "remark")
  @FieldRemark(column = "REMARK", field = "remark", name = "描述")
  private String remark;

  /** 数据权属 */
  @ApiModelProperty(value = "数据权属", name = "dataPerm")
  @FieldRemark(column = "DATA_PERM", field = "dataPerm", name = "数据权属")
  private String dataPerm;

  private String dataPermName;

  /** 数据来源 */
  @ApiModelProperty(value = "数据来源", name = "dataOrigin")
  @FieldRemark(column = "DATA_ORIGIN", field = "dataOrigin", name = "数据来源")
  private String dataOrigin;

  /** 创建时间起 */
  @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
  private java.util.Date creationDateBegin;

  /** 创建时间止 */
  @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
  private java.util.Date creationDateEnd;

  /** 最后修改时间起 */
  @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
  private java.util.Date lastUpdateDateBegin;

  /** 最后修改时间止 */
  @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
  private java.util.Date lastUpdateDateEnd;

  // 校验过程中的错误信息
  @LogField @Transient private String errorMsg;

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getParentId() {
    return parentId;
  }

  public void setParentId(String parentId) {
    this.parentId = parentId;
  }

  public String getParentClassifyName() {
    return parentClassifyName;
  }

  public void setParentClassifyName(String parentClassifyName) {
    this.parentClassifyName = parentClassifyName;
  }

  public String getClassifyName() {
    return classifyName;
  }

  public void setClassifyName(String classifyName) {
    this.classifyName = classifyName;
  }

  public String getClassifyCode() {
    return classifyCode;
  }

  public void setClassifyCode(String classifyCode) {
    this.classifyCode = classifyCode;
  }

  public String getClassifyDes() {
    return classifyDes;
  }

  public void setClassifyDes(String classifyDes) {
    this.classifyDes = classifyDes;
  }

  public String getEditStatus() {
    return editStatus;
  }

  public void setEditStatus(String editStatus) {
    this.editStatus = editStatus;
  }

  public String getExtAttr() {
    return extAttr;
  }

  public void setExtAttr(String extAttr) {
    this.extAttr = extAttr;
  }

  public String getStatus() {
    return status;
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public String getRemark() {
    return remark;
  }

  public void setRemark(String remark) {
    this.remark = remark;
  }

  public String getDataPerm() {
    return dataPerm;
  }

  public void setDataPerm(String dataPerm) {
    this.dataPerm = dataPerm;
  }

  public String getDataPermName() {
    return dataPermName;
  }

  public void setDataPermName(String dataPermName) {
    this.dataPermName = dataPermName;
  }

  public String getDataOrigin() {
    return dataOrigin;
  }

  public void setDataOrigin(String dataOrigin) {
    this.dataOrigin = dataOrigin;
  }

  public java.util.Date getCreationDateBegin() {
    return creationDateBegin;
  }

  public void setCreationDateBegin(java.util.Date creationDateBegin) {
    this.creationDateBegin = creationDateBegin;
  }

  public java.util.Date getCreationDateEnd() {
    return creationDateEnd;
  }

  public void setCreationDateEnd(java.util.Date creationDateEnd) {
    this.creationDateEnd = creationDateEnd;
  }

  public java.util.Date getLastUpdateDateBegin() {
    return lastUpdateDateBegin;
  }

  public void setLastUpdateDateBegin(java.util.Date lastUpdateDateBegin) {
    this.lastUpdateDateBegin = lastUpdateDateBegin;
  }

  public java.util.Date getLastUpdateDateEnd() {
    return lastUpdateDateEnd;
  }

  public void setLastUpdateDateEnd(java.util.Date lastUpdateDateEnd) {
    this.lastUpdateDateEnd = lastUpdateDateEnd;
  }

  public String getSecretLevelName() {
    return secretLevelName;
  }

  public void setSecretLevelName(String secretLevelName) {
    this.secretLevelName = secretLevelName;
  }

  public int getLength() {
    return treePath.length();
  }

  public String getParentClassifyFullName() {
    return parentClassifyFullName;
  }

  public void setParentClassifyFullName(String parentClassifyFullName) {
    this.parentClassifyFullName = parentClassifyFullName;
  }

  @Override
  public Long getTreeSort() {
    return treeSort;
  }

  @Override
  public void setTreeSort(Long treeSort) {
    this.treeSort = treeSort;
  }

  @Override
  public String getLogFormName() {
    if (StringUtils.isEmpty(super.logFormName)) {
      return "数据资产数据目录";
    } else {
      return super.logFormName;
    }
  }

  @Override
  public String getLogTitle() {
    if (StringUtils.isEmpty(super.logTitle)) {
      return "数据资产数据目录";
    } else {
      return super.logTitle;
    }
  }

  @Override
  public PlatformConstant.LogType getLogType() {
    if (super.logType == null) {
      return PlatformConstant.LogType.module_operate;
    } else {
      return super.logType;
    }
  }

  @Override
  public String getErrorMsg() {
    return errorMsg;
  }

  @Override
  public void setErrorMsg(String s) {
    if (Objects.isNull(this.errorMsg)) {
      this.errorMsg = s;
    } else {
      this.errorMsg = this.errorMsg + s;
    }
  }
}
